/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 666
 * Date: 2022-12-12
 * Time: 21:04
 * @author 666
 */
public class test1 {
    public static void main(String[] args) {
     String str="hello java";
     //使用常量进行直接赋值构造
        String str1=new String("hello");
        //使用new String对象
        char[] arr={'j','a','v','a'};
        String str2=new String(arr);
        // 使用字符数组进行构造

        String str3="999";
        String str4="999";
        String str5=new String("999");
        System.out.println(str3==str4);
        System.out.println(str3==str5);
        System.out.println(str3.equals(str5));
        String str6="hello";
        String str7="help";
        String str8="help me";
        System.out.println(str6.compareTo(str7));
        //打印-4，l与p的字符大小差值
        System.out.println(str7.compareTo(str8));
        String str9="sleep";
       System.out.println(str9.charAt(2));
       //打印-3，长度差值
        String str10="hello java";
        System.out.println(str10.indexOf("lo"));
        //打印3
        String str11="1314520";
        int a=Integer.parseInt(str11);
        System.out.println(a);
        //打印数字1314520
        String str12="name";
        char[] arr1=str12.toCharArray();
        for (char c :arr1) {
            System.out.print(c);
        }
        //打印name
        System.out.println();
        String str13="hello";
        System.out.println(str13.replaceAll("lo", "p"));
        //打印help
        System.out.println(str13.replaceFirst("l", "e"));
        //打印heelo
        String str14="123456789";
        String[] arr2=str14.split("");
        String[] arr3=str14.split("",4);
        System.out.println(arr2.length);
        //打印9
        System.out.println(arr3.length);
        //打印4
        String str15="java";
        System.out.println(str15.substring(1, 3));
        //打印av
        String str16="AbC";
        System.out.println(str16.toLowerCase());
        //打印abc
        String str17="aBc";
        System.out.println(str17.toUpperCase());
        //打印ABC
        String str18="  o o  ";
        System.out.println(str18);
        //打印  o  o
        System.out.println(str18.trim());
        //打印o  o
        String str19="hel";
        String str20="lo";
        System.out.println(str19+str20);
        //打印hello
        String str21=String.join("","j","a","v","a");
        System.out.println(str21);
        //打印java
    }
}
